cmake_minimum_required(VERSION 3.19)
project(ClientMockServer LANGUAGES CXX)

find_package(Qt6 6.5 REQUIRED COMPONENTS Core Widgets)
find_package(Qt6 REQUIRED COMPONENTS Core HttpServer Protobuf HttpServer)

file(GLOB PB_FILES "../Client/proto/*.proto")

qt_standard_project_setup()

qt_add_executable(ClientMockServer
    WIN32 MACOSX_BUNDLE
    main.cpp
    widget.cpp
    widget.h
    widget.ui
    server.h server.cpp
)

qt_add_protobuf(ClientMockServer PROTO_FILES ${PB_FILES})

target_link_libraries(ClientMockServer
    PRIVATE
        Qt::Core
        Qt::Widgets
)
target_link_libraries(ClientMockServer PRIVATE Qt6::Core Qt6::Protobuf Qt6::HttpServer)

include(GNUInstallDirs)

install(TARGETS ClientMockServer
    BUNDLE  DESTINATION .
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)

qt_generate_deploy_app_script(
    TARGET ClientMockServer
    OUTPUT_SCRIPT deploy_script
    NO_UNSUPPORTED_PLATFORM_ERROR
)
install(SCRIPT ${deploy_script})
